import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class M {

	/**
	 * @param args
	 * @throws Throwable 
	 */
	public static void main(String[] args) throws Throwable {
		BufferedReader bufferedReader = new BufferedReader(
				new InputStreamReader(new FileInputStream(new File("1.txt"))));
		
		try{
			String s;
			Pattern pattern = Pattern.compile("([^,. \\t\\n\\x0b\\r\\f])+");
			while ((s = bufferedReader.readLine()) != null) {
				Matcher matcher = pattern.matcher(s);
				while (matcher.find()) {
					System.out.print(" Start index: " + matcher.start());
					System.out.print(" End index: " + matcher.end() + " ");
					System.out.println("["+matcher.group()+"]");
				}
			}
		}
		finally{
			bufferedReader.close();
		}
	}

}
